﻿@model BBICMS.Model.ViewModel.Identity.RegisterVM
@{
    ViewBag.Title = Title.SignUp;
}

@section header{
<link href="~/Content/iconfont/font-awesome/css/font-awesome.min.css" rel="stylesheet" />
<link href="~/plugins/toastr/toastr.min.css" rel="stylesheet" />

}

@section featured{
    <div class="sitepath">
        <div class="container">
            <div class="row">
            
                <div class="col-sm-8">
                    <ol class="breadcrumb">
                        <li><a href="/">@Menu.Home</a></li>
                        <li class="active">@ViewBag.Title</li>
                    </ol>
                </div>
            </div>
        </div>
    </div>
}



<div class="container page-register">
    <h3 class="sectiontitle">
        @ViewBag.Title
    </h3>
    <div class="panel panel-default">
        <div class="panel-body">
            <div class="registerbox">
               @using (Ajax.BeginForm("Register", null, new AjaxOptions
               {

                   HttpMethod = "POST",
                   OnBegin = "onBeginSave",
                   OnComplete = "onCompleteSave",
                   OnSuccess = "updateSuccess"

               }, new {role = "form" }))
               {
                    @Html.AntiForgeryToken()
                    @Html.ValidationSummary(true)

                   

                    <div class="form-group">
                        @Html.LabelFor(u=>u.UserName)                   
                        @Html.TextBoxFor(m => m.UserName, new { @class = "form-control", placeholder = Labels.UserName })
                        @Html.ValidationMessageFor(model => model.UserName)
                    </div>
                    <div class="form-group">
                        @Html.LabelFor(u => u.Password)
                        @Html.PasswordFor(m => m.Password, new { @class = "form-control", placeholder = Labels.Password })
                        @Html.ValidationMessageFor(model => model.Password)
                    </div>
                    <div class="form-group">
                        @Html.LabelFor(u => u.ConfirmPassword)
                        @Html.PasswordFor(m => m.ConfirmPassword, new { @class = "form-control", placeholder = Labels.ConfirmPassword })
                        @Html.ValidationMessageFor(model => model.ConfirmPassword)
                    </div>
                    <div class="form-group">
                        @Html.LabelFor(u => u.Email)  
                        @Html.TextBoxFor(m => m.Email, new { @class = "form-control", placeholder = Labels.Email })
                        @Html.ValidationMessageFor(model => model.Email)
                    </div>
                    <div class="form-group">
                        <button type="submit" class="btn btn-primary btn-block" id="btnSave"><i class="fa fa-plus fa-fw"></i>  @Buttons.Register </button>                   
                    </div>
                        <p>@Html.ActionLink(Buttons.AlreadyHaveAccountLoginNow, "Login")</p>


                        }
               </div>

        </div>
    </div>
  
</div>





@section scripts {
@Scripts.Render("~/bundles/jqueryvalWithBootstrap")  
<script src="~/plugins/toastr/toastr.min.js"></script>
    <script>

        function onBeginSave() {
            $("#btnSave i").removeClass("fa-plus").addClass("fa-spinner fa-spin");
        }
        function onCompleteSave() {
            $("#btnSave i").removeClass("fa-spinner fa-spin").addClass("fa-plus");
        }

        function updateSuccess(data) {
            var title = '@ViewBag.Title';
            Common.ShowBox(data.Status, data.Message, title);
            if (data.Status === 1) {
                setTimeout(function () {
                    location.href = "@Url.Action("Login")";
                },1000)
            }

        }


        $(function () {           

        });
    </script>


}
